package com.poizon.exception;

import com.poizon.vo.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName MyExceptionHandler
 * @Author NoCheng
 * @Date 2022/1/10 15:03
 * @Description:TODO 全局异常处理
 */
@ControllerAdvice
public class MyExceptionHandler {
    //处理所有的异常
    @ExceptionHandler
    @ResponseBody
    public R commonException (Exception e) {
        e.printStackTrace();
        return R.fail(e.getMessage());
    }
}
